#include <bits/stdc++.h>
// #define int __int128
#define int long long
using namespace std;
int plen,ptop,pstk[40];
char rdc[1<<20],out[1<<20],*rS,*rT;
#define gc() (getchar())
#define pc(x) (putchar(x))
// #define gc() (rS==rT?rT=(rS=rdc)+fread(rdc,1,1<<20,stdin),(rS==rT?EOF:*rS++):*rS++)
// #define pc(x) out[plen++]=(x)
#define flush() fwrite(out,1,plen,stdout),plen=0
template<class T>inline void read(T &x){
    x=0;char ch;bool f=1;
    while(!isdigit(ch=gc()))if(ch=='-')f^=1;
    do x=(x<<1)+(x<<3)+(ch^48);while(isdigit(ch=gc()));
	if(!f)x=-x;
}
template<class T=int>inline void write(T x){
	if(plen>=1000000)flush();
	if(!x)return pc('0'),void();
	if(x<0)pc('-'),x=-x;
	for(;x;x/=10)pstk[++ptop]=x%10;
	while(ptop)pc(pstk[ptop--]+'0');
}
const int N = 2e6+5;
int n,k,a[N],b[N],s[N],val[N],res[N],now[N];
inline int get(int i,int x){return min(a[i+1],max(a[i]-x,(int)0));}
inline int get2(int i,int x){return min(a[i-1],max(a[i]-x,(int)0));}
inline void solve()
{
    read(n),read(k);
    for(int i = 1;i<n;i++) read(a[i]);
    a[0] = a[n] = 2e9;
    for(int i = 1;i<=k;i++) read(b[i]),s[i] = s[i-1]+b[i];
    for(int i = 1;i<=n;i++) val[i] = s[min(i,k)]-s[max((int)1,k-(n-i))-1];//,cout<<val[i]<<" \n"[i==n];
    int lim = min(a[k],a[k-1]);
    for(int i = 0;i<=lim;i++) res[i] = 0,now[i] = i;
    for(int i = k;i<=n;i++)
    {
        for(int j = 0;j<=lim;j++) res[j]+=now[j]*val[i],now[j] = get(i,now[j]);
    }
    for(int i = 0;i<=lim;i++) now[i] = i;
    for(int i = k-1;i;i--)
    {
        for(int j = 0;j<=lim;j++) now[j] = get2(i,now[j]),res[j]+=now[j]*val[i];
    }
    int ans = 0;
    for(int i = 0;i<=lim;i++)
    {
        ans = max(ans,res[i]);
        // cout<<"x"<<i<<":"<<res[i]<<'\n';
    }
    cout<<ans<<'\n';
}
signed main()
{
    freopen("festival.in","r",stdin);
    freopen("festival.out","w",stdout);
    // ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int subid,T;
    read(subid),read(T);
    for(int _ = 1;_<=T;_++) solve();
    return 0;
}